<?php

require_once 'conexao.php';
$rg = $_POST['rg'];
$_SESSION['rg'] = $rg;

$query = "SELECT * FROM cadastro WHERE rg = " . $rg;
$result = mysql_query($query);

if (mysql_num_rows($result) == 0) {
    $envio = array("status" => "novo");
} else {
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $envio = array("status" => "entrada", "nome" => $row['nome'], "sobrenome" => $row['sobrenome'], "empresa" => $row['empresa'], "foto" => $row['foto']);
    
}
echo json_encode($envio);
?>